﻿Namespace UI.Converters
	''' <summary>
	''' Converts a window state object to visibility. If the parameter is 1 then maximized is visible and all other are collapsed. If parameter is 2 then maximized is collapsed and all other are visible.
	''' </summary>
	''' <remarks></remarks>
	Public Class WindowStatusToVisibilityConverter
		Implements IValueConverter

		Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.Convert
			Try
				Dim ws As WindowState = value
				If CInt(parameter) = 1 Then
					If ws = WindowState.Maximized Then
						Return Visibility.Visible
					Else
						Return Visibility.Collapsed
					End If
				ElseIf CInt(parameter) = 2 Then
					If ws = WindowState.Maximized Then
						Return Visibility.Collapsed
					Else
						Return Visibility.Visible
					End If
				Else
					Return Visibility.Visible
				End If
			Catch
				Return Visibility.Visible
			End Try
		End Function

		Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
			Throw New NotImplementedException
		End Function
	End Class
End Namespace